<!DOCTYPE html>
<html>
	<head>
		<title></title>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
		<link href="__STATIC__/bootstrap/css/bootstrap.min.css" rel="stylesheet" media="screen">
		<script type="text/javascript" src="__STATIC__/jquery-2.1.3.js"></script>
		<script src="__STATIC__/sweetalert/sweetalert.min.js"></script>
		<link href="__STATIC__/sweetalert/sweetalert.css" rel="stylesheet"/>
		<style>
			body {
				margin: 0;
			}
			label {
				color: grey;
			}
			.highlight {
				border: 1px solid #e1e1e8;
				background: #fff;
				border-radius: 4px;
				margin: 0;
				padding: 15px 0 0;
			}
			.pt5 {
				padding-top: 5px;
			}
			.alert {
				margin-bottom: 0;
			}
		</style>
	</head>

	<body>
		<!-- top -->
		<div class="container">
			<div class="row">
				<!-- right -->
				<div class="col-md-12">
					<div class="row" style="margin:5px 0;">
								<div id="actTips" class="col-xs-12 alert alert-info">
									<h5>小秘书提示：你可以在这里编辑密码</h3>
								</div>
							</div>
					<div class="row highlight form-horizontal" style="padding:5px 10px;">
							<input type="hidden" id="id" name="id" value="{$sysuser.id}"/>	
								
							<div class="form-group">
								<label class="col-xs-2 control-label">姓名:</label>
								<div class="col-xs-6">
									<input class="form-control" id="name" name="name" value="{$sysuser.name}" placeholder="姓名"/>
								</div>
							</div>
							<div class="form-group">
								<label for="address" class="col-xs-2 control-label">旧密码：</label>
								<div class="col-xs-6">
									<input type="password" class="form-control" id="oldpassword" name="oldpassword"  placeholder="旧密码">
								</div>
							</div>
							<div class="form-group">
								<label for="address" class="col-xs-2 control-label">新密码：</label>
								<div class="col-xs-6">
									<input type="password" class="form-control" id="password" name="password"  placeholder="新密码">
								</div>
							</div>
							<div class="form-group">
								<label for="address" class="col-xs-2 control-label">确认新密码：</label>
								<div class="col-xs-6">
									<input type="password" class="form-control" id="con_password" name="con_password"  placeholder="确认新密码">
								</div>
							</div>
							<div class="form-group">
								<div class="col-xs-6 col-xs-offset-2">
									<button type="button" class=" form-control btn btn-success" id="sub">提交</button>
								</div>
							</div>
					</div>
				</div>
			</div>
		</div>
		<script>
		$('#sub').click(function(){
			var name = $('#name').val(),
				oldpassword = $('#oldpassword').val(),
				password = $('#password').val(),
				con_password = $('#con_password').val();
			if( password!=con_password || !password || !con_password){
				swal('请重新确认新密码','','error');
			}else{
				$.post("{:U('Index/checkpsw')}",{oldpsw:oldpassword},function(res){
					if(!res){
						swal('旧密码错误','','error');
					}else{
						$.post("{:U('Index/edit')}",{password:password,name:name},function(res){
							if(res){	
								swal('修改成功','','success');
							}else{
								swal('修改失败','','error');
							}
						});
					}
				});
			}
		});
		</script>
	</body>

</html>

</html>